<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>'
    <script>
        let arr1=[12,3,45,67,6];
        let arr2=[1,2,3,4,5];
        // concat()将多个数组合并成一个数组
        let res=arr1.concat(arr2);
        console.log(res);

        // join(分隔符)将数组元素通过指定分隔符拼接成一个字符串，默认使用逗号连接
        let arr3=["aa","bb","cc"];
        // let res2=arr3.join();//默认使用逗号连接
        let res2=arr3.join("-");
        console.log(res2);

        // reverse()将数组中元素顺序颠倒过来
        let arr4=["aa","bb","cc"];
        arr4.reverse();
        console.log(arr4);

        //sort()对数组中元素进行排序，默认按照字典顺序排序
        let arr5=["baby","coco","lucy","admin","blake","ac"];
        arr5.sort();
        console.log(arr5);
        let arr6=[89,7,9,659,129,11,10,5897];
        arr6.sort();
        console.log(arr6);
        //自定义比较规则
        let arr7=[89,7,9,659,129,11,10,5897];
        // arr7.sort(function(a,b){
        //     // return a-b;//升序
        //     return b-a;//降序
        // });
        arr7.sort((a,b)=>a-b);
        console.log(arr7);

        //slice(start,end)  从起始索引开始截取到指定索引，不包含end,[start,end)
        let arr8=["baby","coco","lucy","admin","blake","ac"];
        // let res3=arr8.slice(2,4);//从索引为2的开始截取到索引为4的结束，不包含索引为4
        let res3=arr8.slice(2);//从索引为2的开始截取到末尾
        console.log(res3);

        //push()向数组的末尾添加一个或者多个元素
        // arr8.push("哈哈哈");
        arr8.push("哈哈哈","嘻嘻");
        console.log(arr8);
    </script>
</head>
<body>

</body>
</html>